/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.duckhunter.bloodbath;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;

/**
 * ITS-381-B Web Apps for Mobile Devices - Java ME MObile Game Project
 * @author Duck Hunter Team
 */
public class DuckMIDlet
        extends MIDlet implements CommandListener {

    private Command exitCommand; // The exit command
    private DuckHunterCanvas gameCanvas;

    public DuckMIDlet() {
        gameCanvas = new DuckHunterCanvas();
    }

    public void startApp() {
        Display.getDisplay(this).setCurrent(gameCanvas = new DuckHunterCanvas());
        gameCanvas.addCommand(exitCommand = new Command("Exit", Command.EXIT, 0));
        gameCanvas.setCommandListener(this);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void commandAction(Command c, Displayable s) {
        if (c == exitCommand) {
            destroyApp(false);
            notifyDestroyed();
        }
    }
}
